<?php

use yii\helpers\Html;
use yii\grid\GridView;
use backend\helpers\ActionButton;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\FurniturePlaceSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Места размещения';
$this->params['breadcrumbs'][] = ['label' => 'Каталог мебели и оборудования', 'url' => ['furniture/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container furniture-place-index">

    <h1 class="main-title"><?= Html::encode($this->title) ?></h1>

    <p>
        <?= ActionButton::create('Добавить площадку, склад или магазин', 'createFurniturePlace') ?>
    </p>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

</div>

<div class="container contract-table-container">

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'tableOptions' => [
            'class' => 'table table-striped'
        ],
        'filterModel' => $searchModel,
        'columns' => [
        
            //'id',
            'title',
            'description',
            //'date_end',
            [
                'attribute'=>'type',
                'value' => function($model) {
                    return \backend\models\FurniturePlace::TYPE_LIST[$model->type];
                },
            ],
            [
                'class' => 'yii\grid\ActionColumn',
                'visibleButtons' =>
                [
                    'view' => Yii::$app->user->can('browseFurniturePlace'),
                    'update' => Yii::$app->user->can('updateFurniturePlace'),
                    'delete' => Yii::$app->user->can('deleteFurniturePlace'),
                ]
            ],
        ],
    ]); ?>


</div>
